package net.zz.base.service;

import org.hibernate.validator.HibernateValidator;
import org.hibernate.validator.HibernateValidatorConfiguration;
import org.hibernate.validator.cfg.ConstraintMapping;
import org.springframework.stereotype.Component;

import javax.validation.Validation;
import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import java.lang.reflect.Method;

/**
 * Created by ZaoSheng on 2015/5/9.
 */
@Component
public class ValidateParameters {


    public void validate(Object valiObject, Method method, Object[] parameValue ){
        Validator validator = Validation.buildDefaultValidatorFactory() .getValidator();


    }
    public void validatea(){
        ConstraintMapping mapping = new ConstraintMapping();
// configure mapping instance

        HibernateValidatorConfiguration config = Validation.byProvider( HibernateValidator.class ).configure();
        config.addMapping( mapping );
        ValidatorFactory factory = config.buildValidatorFactory();
        Validator validator = factory.getValidator();

        HibernateValidatorConfiguration configuration = Validation.byProvider( HibernateValidator.class ).configure();
        ValidatorFactory factory1 = configuration.failFast( true ).buildValidatorFactory();
        Validator validato1r = factory.getValidator();


    }


}
